/*
 Navicat Premium Data Transfer

 Source Server         : mysql5.7-3306
 Source Server Type    : MySQL
 Source Server Version : 50727
 Source Host           : localhost:3306
 Source Schema         : ti

 Target Server Type    : MySQL
 Target Server Version : 50727
 File Encoding         : 65001

 Date: 30/10/2019 09:00:07
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ti_categories
-- ----------------------------
DROP TABLE IF EXISTS `ti_categories`;
CREATE TABLE `ti_categories` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `cat_name` varchar(30) NOT NULL COMMENT '分类名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Records of ti_categories
-- ----------------------------
BEGIN;
INSERT INTO `ti_categories` VALUES (1, 'HTML');
INSERT INTO `ti_categories` VALUES (2, 'CSS');
INSERT INTO `ti_categories` VALUES (3, 'JavaScript');
INSERT INTO `ti_categories` VALUES (4, 'Vue');
INSERT INTO `ti_categories` VALUES (5, 'Node');
INSERT INTO `ti_categories` VALUES (6, 'ES6');
COMMIT;

-- ----------------------------
-- Table structure for ti_questions
-- ----------------------------
DROP TABLE IF EXISTS `ti_questions`;
CREATE TABLE `ti_questions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `title` varchar(255) NOT NULL COMMENT '题目标题',
  `options` varchar(255) NOT NULL COMMENT '选项',
  `right` tinyint(255) unsigned NOT NULL COMMENT '正确答案，0-3之间的数字',
  `category_id` int(11) unsigned NOT NULL COMMENT '分类ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Records of ti_questions
-- ----------------------------
BEGIN;
INSERT INTO `ti_questions` VALUES (1, 'p标签的用途是？', '跳转,登录,图片,段落', 3, 1);
COMMIT;

-- ----------------------------
-- Table structure for ti_user_questions
-- ----------------------------
DROP TABLE IF EXISTS `ti_user_questions`;
CREATE TABLE `ti_user_questions` (
  `user_id` int(11) unsigned NOT NULL COMMENT '用户ID',
  `question_id` int(11) unsigned NOT NULL COMMENT '题目ID',
  `answer` tinyint(3) unsigned NOT NULL COMMENT '答案，0-3之间的数字',
  `isright` tinyint(1) unsigned NOT NULL COMMENT '是否正确，0：错误 1：正确',
  PRIMARY KEY (`user_id`,`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Records of ti_user_questions
-- ----------------------------
BEGIN;
INSERT INTO `ti_user_questions` VALUES (1, 1, 3, 1);
COMMIT;

-- ----------------------------
-- Table structure for ti_users
-- ----------------------------
DROP TABLE IF EXISTS `ti_users`;
CREATE TABLE `ti_users` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `username` varchar(30) NOT NULL COMMENT '用户名',
  `password` char(32) NOT NULL COMMENT '密码',
  `face` varchar(255) DEFAULT NULL COMMENT '头像',
  `integral` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `regtime` int(10) unsigned NOT NULL COMMENT '注册时间戳',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Records of ti_users
-- ----------------------------
BEGIN;
INSERT INTO `ti_users` VALUES (1, 'tom', '6e1331fbbc40fc31a48d87c6a385292f', 'http://localhost:9999/uploads/20191030/1572395913724.jpg', 0, 1572344669);
INSERT INTO `ti_users` VALUES (2, '张三', 'b8f79e50bfbc318ec563c8387388e7f8', NULL, 0, 1572351614);
INSERT INTO `ti_users` VALUES (3, 'tom123', '6e1331fbbc40fc31a48d87c6a385292f', NULL, 0, 1572396188);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
